<?php /*a:3:{s:64:"D:\phpstudy_pro\WWW\mrht5.3\application\admin\view\km\index.html";i:1648208647;s:72:"D:\phpstudy_pro\WWW\mrht5.3\application\admin\view\..\common\header.html";i:1648208647;s:72:"D:\phpstudy_pro\WWW\mrht5.3\application\admin\view\..\common\footer.html";i:1648208647;}*/ ?>

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="Light Year Admin V4是一个基于Bootstrap v4.4.1的后台管理系统的HTML模板。">
    <meta name="author" content="yinq">
    <title>后台管理</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <link rel="stylesheet" type="text/css" href="/static/css/materialdesignicons.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/style.min.css">
    <link rel="stylesheet" type="text/css" href="/static/js/jquery-confirm/jquery-confirm.min.css">
    <link rel="stylesheet" type="text/css" href="/static/js/bootstrap-datepicker/bootstrap-datepicker3.min.css">
    <link rel="stylesheet" type="text/css" href="/static/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="/static/js/bootstrap-clockpicker/bootstrap-clockpicker.min.css">
</head>

<body>

<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a><h1>后台管理</h1></a>
            </div>
            <div class="lyear-layout-sidebar-info lyear-scroll">

                <nav class="sidebar-main">
                    <ul class="nav-drawer">
                        <li class="nav-item active"> <a href="<?php echo url('/admin/index'); ?>"><i class="mdi mdi-home"></i> <span>后台首页</span></a> </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-android"></i> <span>应用管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/app/index'); ?>">应用管理</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> <span>用户管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/user/index'); ?>">用户管理</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-credit-card"></i> <span>卡密管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/km/index'); ?>">卡密管理</a> </li>
                                <li> <a href="<?php echo url('/admin/km/addkm'); ?>">添加卡密</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-clipboard-text"></i> <span>笔记管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/notes/index'); ?>" >笔记管理</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-email"></i> <span>邮箱管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/email/index'); ?>">邮箱配置</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-shopping"></i> <span>商城管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/shop/index'); ?>">商品管理</a> </li>
                                <li> <a href="<?php echo url('/admin/shop/shoporder'); ?>">订单管理</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-table-large"></i> <span>论坛管理</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="<?php echo url('/admin/bbs/plate'); ?>">论坛管理</a> </li>
                                <li> <a href="<?php echo url('/admin/bbs/platepost'); ?>">帖子管理</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-menu"></i> <span>多级菜单</span></a>
                            <ul class="nav nav-subnav">
                                <li> <a href="#!">一级菜单</a> </li>
                                <li class="nav-item nav-item-has-subnav">
                                    <a href="#!">一级菜单</a>
                                    <ul class="nav nav-subnav">
                                        <li> <a href="#!">二级菜单</a> </li>
                                        <li class="nav-item nav-item-has-subnav">
                                            <a href="#!">二级菜单</a>
                                            <ul class="nav nav-subnav">
                                                <li> <a href="#!">三级菜单</a> </li>
                                                <li> <a href="#!">三级菜单</a> </li>
                                            </ul>
                                        </li>
                                    </ul>
                                </li>
                                <li> <a href="#!">一级菜单</a> </li>
                            </ul>
                        </li>
                    </ul>
                </nav>

                <div class="sidebar-footer">
                    <p class="copyright">Copyright &copy; 2019. <a target="_blank" href="http://lyear.itshubao.com">IT书包</a> All rights reserved.</p>
                </div>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar">

                <div class="navbar-left">
                    <div class="lyear-aside-toggler">
                        <span class="lyear-toggler-bar"></span>
                        <span class="lyear-toggler-bar"></span>
                        <span class="lyear-toggler-bar"></span>
                    </div>
                </div>

                <ul class="navbar-right d-flex align-items-center">
                    <li class="dropdown dropdown-notice">
            <span data-toggle="dropdown" class="icon-item">
              <i class="mdi mdi-bell-outline"></i>
              <span class="badge badge-danger">10</span>
            </span>
<!--                        <div class="dropdown-menu dropdown-menu-right">-->
<!--                            <div class="lyear-notifications">-->
<!--                                <div class="lyear-notifications-title clearfix"  data-stopPropagation="true"><a href="#!" class="float-right">查看全部</a>你有 10 条未读消息</div>-->
<!--                                <div class="lyear-notifications-info lyear-scroll">-->
<!--                                    <a href="#!" class="dropdown-item" title="树莓派销量猛增，疫情期间居家工作学习、医疗领域都需要它">树莓派销量猛增，疫情期间居家工作学习、医疗领域都需要它</a>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
                    </li>
                    <!--切换主题配色-->
                    <li class="dropdown dropdown-skin">
                        <span data-toggle="dropdown" class="icon-item"><i class="mdi mdi-palette"></i></span>
                        <ul class="dropdown-menu dropdown-menu-right" data-stopPropagation="true">
                            <li class="drop-title"><p>主题</p></li>
                            <li class="drop-skin-li clearfix">
                <span class="inverse">
                  <input type="radio" name="site_theme" value="default" id="site_theme_1" checked>
                  <label for="site_theme_1"></label>
                </span>
                                <span>
                  <input type="radio" name="site_theme" value="dark" id="site_theme_2">
                  <label for="site_theme_2"></label>
                </span>
                                <span>
                  <input type="radio" name="site_theme" value="translucent" id="site_theme_3">
                  <label for="site_theme_3"></label>
                </span>
                            </li>
                            <li class="drop-title"><p>LOGO</p></li>
                            <li class="drop-skin-li clearfix">
                <span class="inverse">
                  <input type="radio" name="logo_bg" value="default" id="logo_bg_1" checked>
                  <label for="logo_bg_1"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_2" id="logo_bg_2">
                  <label for="logo_bg_2"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_3" id="logo_bg_3">
                  <label for="logo_bg_3"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_4" id="logo_bg_4">
                  <label for="logo_bg_4"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_5" id="logo_bg_5">
                  <label for="logo_bg_5"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_6" id="logo_bg_6">
                  <label for="logo_bg_6"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_7" id="logo_bg_7">
                  <label for="logo_bg_7"></label>
                </span>
                                <span>
                  <input type="radio" name="logo_bg" value="color_8" id="logo_bg_8">
                  <label for="logo_bg_8"></label>
                </span>
                            </li>
                            <li class="drop-title"><p>头部</p></li>
                            <li class="drop-skin-li clearfix">
                <span class="inverse">
                  <input type="radio" name="header_bg" value="default" id="header_bg_1" checked>
                  <label for="header_bg_1"></label>                      
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_2" id="header_bg_2">
                  <label for="header_bg_2"></label>                      
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_3" id="header_bg_3">
                  <label for="header_bg_3"></label>
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_4" id="header_bg_4">
                  <label for="header_bg_4"></label>                      
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_5" id="header_bg_5">
                  <label for="header_bg_5"></label>                      
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_6" id="header_bg_6">
                  <label for="header_bg_6"></label>                      
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_7" id="header_bg_7">
                  <label for="header_bg_7"></label>
                </span>
                                <span>
                  <input type="radio" name="header_bg" value="color_8" id="header_bg_8">
                  <label for="header_bg_8"></label>
                </span>
                            </li>
                            <li class="drop-title"><p>侧边栏</p></li>
                            <li class="drop-skin-li clearfix">
                <span class="inverse">
                  <input type="radio" name="sidebar_bg" value="default" id="sidebar_bg_1" checked>
                  <label for="sidebar_bg_1"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_2" id="sidebar_bg_2">
                  <label for="sidebar_bg_2"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_3" id="sidebar_bg_3">
                  <label for="sidebar_bg_3"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_4" id="sidebar_bg_4">
                  <label for="sidebar_bg_4"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_5" id="sidebar_bg_5">
                  <label for="sidebar_bg_5"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_6" id="sidebar_bg_6">
                  <label for="sidebar_bg_6"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_7" id="sidebar_bg_7">
                  <label for="sidebar_bg_7"></label>
                </span>
                                <span>
                  <input type="radio" name="sidebar_bg" value="color_8" id="sidebar_bg_8">
                  <label for="sidebar_bg_8"></label>
                </span>
                            </li>
                        </ul>
                    </li>
                    <!--切换主题配色-->
                    <li class="dropdown dropdown-profile">
                        <a href="javascript:void(0)" data-toggle="dropdown" class="dropdown-toggle">
                            <img id="adminnewtx" class="img-avatar img-avatar-48 m-r-10" src="http://q1.qlogo.cn/g?b=qq&nk=<?php echo htmlentities(app('session')->get('adminqq')); ?>&s=640" />
                            <span id="adminnewname"><?php echo htmlentities(app('session')->get('adminname')); ?></span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-right">
                            <li>
                                <a class="dropdown-item" href="<?php echo url('/admin/admin/admininfo'); ?>"><i class="mdi mdi-account"></i> 个人信息</a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="<?php echo url('/admin/admin/changepwd'); ?>"><i class="mdi mdi-lock-outline"></i> 修改密码</a>
                            </li>
                            <li>
                                <a class="dropdown-item" href="javascript:void(0)" onclick="Clear_All()" ><i class="mdi mdi-delete"></i> 清空缓存</a>
                            </li>
                            <li class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item" onclick="loginout()" href="javascript:void(0)"><i class="mdi mdi-logout-variant"></i> 退出登录</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </header>
        <!--End 头部信息-->

<!--页面主要内容-->
<main class="lyear-layout-content">
  <div class="container-fluid p-t-15">
    <div class="row">
      <div class="col-lg-12">
        <div class="card">
          <div class="card-toolbar d-flex flex-column flex-md-row">
            <div class="toolbar-btn-action">
              <a href="<?php echo url('/admin/km/addkm'); ?>" class="btn btn-primary m-r-5" ><i class="mdi mdi-plus"></i> 新增</a>
              <a class="btn btn-danger" onclick="delkmtotal()"><i class="mdi mdi-window-close"></i> 删除</a>
            </div>

            <div class="search-bar ml-md-auto">
              <input type="hidden" name="search_field" id="search-field" value="title" />
              <div class="input-group ml-md-auto">
                  <div class="input-group mb-3">
                    <input type="text" id="km" class="form-control" placeholder="卡密">
                    <div class="input-group-append">
                      <span class="input-group-text" onclick="searchkm()">搜索</span>
                    </div>
                  </div>
              </div>
            </div>
          </div>
          <div class="card-body">

            <div class="table-responsive">
              <table class="table table-bordered">
                <thead>
                <tr>
                  <th>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input" id="check-all">
                      <label class="custom-control-label" for="check-all"></label>
                    </div>
                  </th>
                  <th>序号</th>
                  <th>卡密</th>
                  <th>经验值</th>
                  <th>金币值</th>
                  <th>vip天数</th>
                  <th>应用名称</th>
                  <th>使用者</th>
                  <th>使用时间</th>
                  <th>创建时间</th>
                  <th>操作</th>
                </tr>
                </thead>
                <tbody id="search_result">
                <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $k = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$km): $mod = ($k % 2 );++$k;?>
                <tr id="<?php echo htmlentities($km['id']); ?>">
                  <td>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input ids" name="ids[]" value="<?php echo htmlentities($km['id']); ?>" id='ids<?php echo htmlentities($km['id']); ?>'>
                      <label class="custom-control-label" for="ids<?php echo htmlentities($km['id']); ?>"></label>
                    </div>
                  </td>
                  <td><?php echo htmlentities($k); ?></td>
                  <td><?php echo htmlentities($km['km']); ?></td>
                  <td><?php echo htmlentities($km['exp']); ?></td>
                  <td><?php echo htmlentities($km['money']); ?></td>
                  <td><?php echo htmlentities($km['vip']); ?></td>
                  <td><?php echo htmlentities($km['appname']); ?></td>
                  <td><?php echo htmlentities($km['username']); ?></td>
                  <td><?php echo htmlentities($km['usetime']); ?></td>
                  <td><?php echo htmlentities(date('Y-m-d H:i:s',!is_numeric($km['creattime'])? strtotime($km['creattime']) : $km['creattime'])); ?></td>
                  <td>
                    <div class="btn-group">
                      <a class="btn btn-xs btn-default id ajax-get confirm" dataid = "<?php echo htmlentities($km['id']); ?>" onclick="deletekm(this)" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                    </div>
                  </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
              </table>
            </div>
            <?php echo $page; ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</main>
<!--End 页面主要内容-->
</div>
</div>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/popper.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-confirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="/static/js/main.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-notify.min.js"></script>
<!--图标插件-->
<script type="text/javascript" src="/static/js/Chart.min.js"></script>
<!--loding插件-->
<script type="text/javascript" src="/static/js/lyear-loading.js"></script>
<!--时间日期选择器-->
<script type="text/javascript" src="/static/js/momentjs/moment.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/static/js/momentjs/locale/zh-cn.min.js"></script>
<script type="text/javascript">
    //清除所有缓存
    function Clear_All(obj) {
        $.ajax({
            type:'get',
            url:"<?php echo url('/admin/admin/clear_all'); ?>",
            data: {},
            dataType: "json",
            success:function (data){
                $.alert({
                    title: '成功提示',
                    icon: 'mdi mdi-alert',
                    type: 'green',
                    content: data.msg
                });
            }
        })
    }

    function loginout() {
        $.ajax({
            type:'get',
            url:"<?php echo url('/admin/admin/loginout'); ?>",
            data: {},
            dataType: "json",
            success:function (data){
                location.reload();
            }
        })
    }
</script>
<script>
  function getnumber() {
    var date = $("input[name = 'ids[]']");
    var str = [];
    for(let i = 0;i < date.length;i++) {
      if (date[i].checked == true) {
        str.push(date[i].value);
      }
    }
    return str;
  }

  function deletekm(obj){
    var l = $('body').lyearloading({
      opacity: 0.2,
      spinnerSize: 'lg',
      spinnerText: '后台处理中，请稍后...',
      textColorClass: 'text-info',
      spinnerColorClass: 'text-info'
    });
    var id = $(obj).attr("dataid");
    $.ajax({
      type: "POST",
      url: "<?php echo url('/admin/km/delkm'); ?>",
      data: {
        id: id,
      },
      //dataType: "json",
      success: function (data) {
        setTimeout(function() {
          l.destroy();
        }, 1e3)
        if (data.code == 200) {
          $.notify({
            message: data.msg
          },{
            placement: {
              from: "top",
              align: "center"
            },
            type: 'success'
          });
          setTimeout("location.reload();", 2000);
        } else {
          $.notify({
            message: data.msg
          },{
            placement: {
              from: "top",
              align: "center"
            },
            // settings
            type: 'danger'
          });
        }
      },
    });
  }

  function delkmtotal(){
    var getnum = getnumber().toString();
    //console.log(getnum);
    if (getnum.length == 0){
      $.notify({
        message: "你还没有选择呢",
      },{
        placement: {
          from: "top",
          align: "center"
        },
        type: 'success'
      });
    }else{
      var l = $('body').lyearloading({
        opacity: 0.2,
        spinnerSize: 'lg',
        spinnerText: '后台处理中，请稍后...',
        textColorClass: 'text-info',
        spinnerColorClass: 'text-info'
      });
      $.ajax({
        type: "POST",
        url: "<?php echo url('/admin/km/delkm'); ?>",
        data: {
          id: getnum
        },
        dataType: "json",
        success: function (data) {
          setTimeout(function() {
            l.destroy();
          }, 1e3)
          if (data.code == 200) {
            $.notify({
              message: data.msg
            },{
              placement: {
                from: "top",
                align: "center"
              },
              type: 'success'
            });
            setTimeout("location.reload();", 2000);
          } else {
            $.notify({
              message: data.msg
            },{
              placement: {
                from: "top",
                align: "center"
              },
              // settings
              type: 'danger'
            });
          }
        },
      });
    }
  }

  function searchkm(){
    var searchkm = $.trim($("#km").val());
    if (searchkm == "" || searchkm == null){
      $.notify({
        message: '请输入搜索内容'
      },{
        placement: {
          from: "top",
          align: "center"
        },
        // settings
        type: 'danger'
      });
      return false;
    }
    var l = $('body').lyearloading({
      opacity: 0.2,
      spinnerSize: 'lg',
      spinnerText: '后台处理中，请稍后...',
      textColorClass: 'text-info',
      spinnerColorClass: 'text-info'
    });
    $.ajax({
      type: "POST",
      url: "/admin/km/searchkm",
      data: {
        searchkm: searchkm,
      },
      dataType: "json",
      success: function (json) {
        setTimeout(function() {
          l.destroy();
        }, 1e3)
        if (json.code == 200){
          console.log(json);
          var s = "";
          for (var i = 0;i<json.data.length;i++) {
            console.log(json.data.length);
            s += '<tr><td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input ids" name="ids[]" value="'+
                    json.data[i].id +
                    '" id="ids'+
                    json.data[i].id+
                    '"><label class="custom-control-label" For="ids'+
                    json.data[i].id+
                    '"></label></div></td><td>' +
                    (i+1) +
                    "</td><td>" +
                    json.data[i].km +
                    "</td><td>" +
                    json.data[i].exp +
                    "</td><td>" +
                    json.data[i].money +
                    "</td><td>" +
                    json.data[i].vip +
                    "</td><td>" +
                    json.data[i].appname +
                    "</td><td>" +
                    json.data[i].username +
                    "</td><td>" +
                    json.data[i].usetime +
                    "</td><td>" +
                    json.data[i].creattime +
                    '</td><td><div class="btn-group"><a class="btn btn-xs btn-default id ajax-get confirm" dataid = "'+
                    json.data[i].id +
                    '" onclick="deletekm(this)" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a></td></tr>';
          }
          $("#search_result").html(s);
        }else{
          $.notify({
            message: data.msg
          },{
            placement: {
              from: "top",
              align: "center"
            },
            // settings
            type: 'danger'
          });
        }
      }
    })
  }
</script>

</body>

</html>
